package com.xwn.utils.core;

import com.xwn.base.DubboResp;
import com.xwn.utils.Contant;

/**
 * @Author duandw
 * @Date 2019/12/31 17:21
 **/
public class DubboRespUtilsImpl {
    public DubboRespUtilsImpl() {
    }

    private static <T> DubboResp buildDubboResp(Integer code, String msg, T t) {
        DubboResp<T> resp = new DubboResp();
        resp.setCode(code);
        resp.setMsg(msg);
        resp.setData(t);
        return resp;
    }

    public static DubboResp buildResp(int code) {
        return buildDubboResp(code, (String)null, (Object)null);
    }

    public static DubboResp buildResp(int code, String msg) {
        return buildDubboResp(code, msg, (Object)null);
    }

    public static DubboResp buildResp(int code, T t) {
        return buildDubboResp(code, (String)null, t);
    }

    public static DubboResp buildResp(int code, String msg, T t) {
        return buildDubboResp(code, msg, t);
    }

    public static <T> DubboResp buildSuccResp() {
        return buildDubboResp(Contant.RESP_CODE_SUCC, (String)null, (Object)null);
    }

    public static <T> DubboResp buildSuccResp(String msg) {
        return buildDubboResp(Contant.RESP_CODE_SUCC, msg, (Object)null);
    }

    public static <T> DubboResp buildSuccResp(T t) {
        return buildDubboResp(Contant.RESP_CODE_SUCC, (String)null, t);
    }

    public static <T> DubboResp buildSuccResp(String msg, T t) {
        return buildDubboResp(Contant.RESP_CODE_SUCC, msg, t);
    }

    public static <T> DubboResp buildFailResp() {
        return buildDubboResp(Contant.RESP_CODE_FAIL, (String)null, (Object)null);
    }

    public static <T> DubboResp buildFailResp(String msg) {
        return buildDubboResp(Contant.RESP_CODE_FAIL, msg, (Object)null);
    }

    public static <T> DubboResp buildFailResp(T t) {
        return buildDubboResp(Contant.RESP_CODE_FAIL, (String)null, t);
    }

    public static <T> DubboResp buildFailResp(String msg, T t) {
        return buildDubboResp(Contant.RESP_CODE_FAIL, msg, t);
    }
}
